// pages/withdrawDetailPage/withdrawDetailPage.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    orderId: 0,
    money: [],
    order:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    this.setData({
      payId: options.payId,
      orderId: options.orderId
    })
    wx.request({
      url: 'https://www.xiaozheng8.com/money/record/findByPayId',
      data: {
        payId: that.data.payId
      },
      method: 'post',
      success: function (res) {
        console.log(res);
        that.setData({
          money: [res.data.data]
        })
        if (that.data.money[0].money > 0) {
          wx.setNavigationBarTitle({
            title: '收入',
          })
        } else {
          wx.setNavigationBarTitle({
            title: '提现',
          })
        }
      },
      fail: function (res) { },
      complete: function (res) { },
    });
    if (that.data.orderId != null) {
      wx.request({
        url: 'https://www.xiaozheng8.com/serviceOrder/receiveFindById',
        data: {
          orderId: that.data.orderId,
          userId: wx.getStorageSync("userId")
        },
        method: 'post',
        success: function (res) {
          console.log(res);
          that.setData({
            order:res.data.data.project,
            orderList:[res.data.data]
          });
          console.log(that.data.order);
        },
        fail: function (res) { },
        complete: function (res) { },
      })
    }

  },
  // 查看该订单
  toOrder:function(){
    var that=this;
    wx.navigateTo({
      url: '../grabSuccess/grabSuccess?orderId='+that.data.orderId,
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})